﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SkyNote.Domain
{
    public abstract class BaseEntity : IEntity
    {
        public DateTime CreateDate
        {
            get;
            set;
        }
        [ReadOnly(false)]
        public bool IsDelete
        {
            get;
            set;
        }
        public Guid ID
        {
            get;
            set;
        }
        public BaseEntity()
        {
            Guid arg_0E_0 = this.ID;
            if (this.ID == Guid.Empty)
            {
                this.ID = Guid.NewGuid();
            }
            this.CreateDate = DateTime.Now;
        }
        public override bool Equals(object obj)
        {
            bool result;
            if (null == obj)
            {
                result = false;
            }
            else
            {
                if (object.ReferenceEquals(this, obj))
                {
                    result = true;
                }
                else
                {
                    BaseEntity baseEntity = obj as BaseEntity;
                    result = (!(null == baseEntity) && this.ID == baseEntity.ID);
                }
            }
            return result;
        }
        public override int GetHashCode()
        {
            return this.ID.GetHashCode();
        }
        public static bool operator ==(BaseEntity lhs, BaseEntity rhs)
        {
            bool result;
            if (lhs == null)
            {
                result = (rhs == null);
            }
            else
            {
                result = lhs.Equals(rhs);
            }
            return result;
        }
        public static bool operator !=(BaseEntity lhs, BaseEntity rhs)
        {
            return !(lhs == rhs);
        }
    }
}
